Skip to content

feat(hotreload): prototype opt-in browser asset rebuilds - #147

Draft
TheAngryByrd wants to merge 2 commits into
WillEhrendreich:masterfrom
TheAngryByrd:prototype/browser-assets
Draft

TheAngryByrd wants to merge 2 commits into
WillEhrendreich:masterfrom
TheAngryByrd:prototype/browser-assets

Conversation

@TheAngryByrd

Copy link
Copy Markdown

What

Summary

Add optional browser-asset builds through sagefs.browser-assets.json. Build execution and asset snapshots are replaceable functions, with no WebSharper dependency in the host.

flowchart TD
  Save[Source change] --> Route{Configured source route}
  Route --> CLR[Existing CLR reload path]
  Route --> Ignore[Ignore excluded generated sources]
  Route --> Build[External browser build]
  Build --> Changed[Changed output: AssetsRebuilt and page refresh]
  Build --> Same[Unchanged output: no refresh]
  Build --> Failed[Build failure: show error without refresh]
Loading

The pipeline serializes builds and adds timeout, cancellation, content hashes, and duplicate-refresh protection. A read-only /__sagefs__/devreload.js endpoint supports same-origin proxy integration.

A generic WebSharper sample documents the configuration and browser workflow. Projects without this configuration retain the existing source route.

Why

CLR reload alone does not rebuild browser JavaScript. This separate path lets external compilers and bundlers produce browser assets while the server remains running.

This prototype provides page refresh, not JavaScript HMR or faster compilation. Shared browser/server source edits require a coordinated rebuild strategy and remain outside its scope.

How to Verify

  1. Follow the WebSharper sample instructions.
  2. Change a client label. Confirm that the browser updates without restarting the host.
  3. Introduce a compiler error, correct it, and save unchanged output. Confirm error reporting, recovery, and no refresh for unchanged output.

Evidence

  • Before: Base cb747060 has the CLR reload path but no browser-asset configuration, controller, or AssetsRebuilt outcome.
  • After: Verification at c0dc74ae produced these results:
Check Result
net11 Release build Passed, zero warnings and errors
Complete ratchet lane 305 passed, Trusted
Browser-asset controller and source routing 32 passed
Reload-script rendering and HTTP guards 82 passed
JavaScript event handling 18 passed

The 114 focused .NET tests report NarrowedRun, not full-suite acceptance. They cover optional exclusions, route boundaries, script rendering, HTTP access rules, and existing reload behavior.

Earlier full Windows runs were not green: net11 reported 51 failures and 122 errors, and net10 reported 50 failures and 124 errors. Those runs predate the final exclusions and script-endpoint changes. Not every failure has a confirmed cause.

This is a draft. Full-suite acceptance and upstream CI remain open. At PR creation, upstream master was nine commits ahead of the branch's base.

Merge Danger

Door: two-way

Remove the optional configuration and restart the session to restore the existing source route. No data migration is required.

Blast Radius: Reloading

The changes affect shared worker routing, reload outcomes, and browser event handling. Focused checks passed, but they do not establish release readiness.

Checklist

  • Release build succeeds with no warnings.
  • Full test acceptance is green. Focused checks and ratchets passed as listed above.
  • Changes use two-space indentation.
  • Commits use conventional messages.
  • Client impact considered: existing CLR routes remain, and browser clients receive a distinct asset outcome.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant